package gzhweichat

//公众号模型


//返回token
type TokenRes struct {
	Access_token string `json:"access_token"`
	Expires_in int `json:"expires_in"`
	Refresh_token string `json:"refresh_token"`
	Openid string `json:"openid"`
	Scope 	string `json:"scope"`
}

//过滤返回的token
type TokenResponse struct {
	Expires_in int `json:"expires_in"`
	Refresh_token string `json:"refresh_token"`
	Openid string `json:"openid"`
	Scope 	string `json:"scope"`
}

//拉取用户信息(需scope为 snsapi_userinfo) 返回参数
type WxUserInfoRes struct {
	Openid string `json:"openid"`
	Nickname string `json:"nickname"`
	Sex int `json:"sex"`
	Province string `json:"province"`
	City string `json:"city"`
	Country string `json:"country"`
	Headimgurl string `json:"headimgurl"`
	Privilege []string `json:"privilege"`
	Unionid string `json:"unionid"`
}

//获取签名前的ticket
type TicketRes struct {
	Errcode    int   `json:"errcode"`
	Ticket    string `json:"ticket"`
	Errmsg    string `json:"errmsg"`
	ExpiresIn    int `json:"expiresIn"`
}

//放在boot里的全局变量的token值
type AllToken struct {
	Access_token string `json:"access_token"`
	Expires_in int `json:"expires_in"`
}



//转换
func TokenResToTokenResponse(res *TokenRes)(*TokenResponse){
	entity:=new(TokenResponse)
	entity.Openid=res.Openid
	entity.Expires_in=res.Expires_in
	entity.Refresh_token=res.Refresh_token
	entity.Scope=res.Scope

	return entity
}
